import request from '@/config/axios'
import type { HMemberCardTransaction } from './types'

export const getHMemberCardTransactionsListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: '/hmember-card-transactions', params })
}

export const createHMemberCardTransactionApi = (
  data: Partial<HMemberCardTransaction>
): Promise<IResponse> => {
  return request.post({ url: '/hmember-card-transactions', data })
}

export const updateHMemberCardTransactionApi = (
  id: string,
  data: Partial<HMemberCardTransaction>
): Promise<IResponse> => {
  return request.put({ url: `/hmember-card-transactions/id/${id}`, data })
}

export const getHMemberCardTransactionsDetailApi = (
  id: string
): Promise<IResponse<HMemberCardTransaction>> => {
  return request.get({ url: `/hmember-card-transactions/id/${id}` })
}

export const delMemberCardTransactionsListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/hmember-card-transactions/id/${ids[0]}` })
}

export const checkOutApi = (id: string): Promise<IResponse> => {
  return request.post({ url: `/hmember-card-transactions/id/${id}/checkout` })
}
